package com.gitee.jisong.superlogger.pojo

import com.gitee.jisong.common.DEFAULT_DATETIME
import com.gitee.jisong.common.DEFAULT_INT
import com.gitee.jisong.common.DEFAULT_LONG
import com.gitee.jisong.common.DEFAULT_STRING
import java.time.LocalDateTime

data class Applications(
        var id : Long = DEFAULT_LONG,
        var appName : String = DEFAULT_STRING,
        var appHost : String = DEFAULT_STRING,
        var appPort : String = DEFAULT_STRING,
        var isHttps : Int = DEFAULT_INT,
        var createTime: LocalDateTime = DEFAULT_DATETIME,
        var updateTime : LocalDateTime = DEFAULT_DATETIME,
        var createUser: Long = DEFAULT_LONG,
        var updateUser : Long = DEFAULT_LONG
){


    fun valid_insert(){
        if(appName == DEFAULT_STRING){
            throw RuntimeException("appName必填")
        }
        if(appHost == DEFAULT_STRING){
            throw RuntimeException("appHost必填")
        }
        if(appPort == DEFAULT_STRING){
            throw RuntimeException("appPort必填")
        }
        if(isHttps == DEFAULT_INT){
            throw RuntimeException("isHttps必填")
        }
    }
}